package cn.wolfcode.controller;

import cn.wolfcode.query.JsonResult;
import cn.wolfcode.service.IEmployeeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class PwdController {

    @Autowired
    private IEmployeeService employeeService;

    @RequestMapping("/updatePwd")
    @ResponseBody
    public JsonResult updatePwd(String oldPassword,String newPassword){
        try {
            employeeService.judageUpdate(oldPassword,newPassword);
            return new JsonResult();
        } catch(Exception e) {
            e.printStackTrace();
            return new JsonResult(e.getMessage(), false);
        }
    }
}
